cmake_minimum_required(VERSION 3.0.2)
project(ibvs_tracker)

## Find catkin macros and libraries
## search for catkin package in all workspaces and append their include directories and libraries to this project
find_package(catkin REQUIRED COMPONENTS
  rospy
  std_msgs
  geometry_msgs
  mavros_msgs
  vision_msgs # Ensure this is installed: sudo apt install ros-<your_ros_distro>-vision-msgs
  tf
  tf_conversions # For tf.transformations in Python
  # If you were defining custom messages, you'd add message_generation here
)

## Uncomment this if the package has a setup.py. This spawns a setuptools installer.
## For simple Python scripts, this isn't strictly necessary if you install them manually below.
## However, if you plan to distribute your package or use entry points, enable this.
# catkin_python_setup()

################################################
## Declare ROS specific flags here
################################################

## Catkin specific configuration
## The catkin_package macro exposes the package to the Catkin build system
## and other Catkin packages.
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES ibvs_tracker
  CATKIN_DEPENDS
    rospy
    std_msgs
    geometry_msgs
    mavros_msgs
    vision_msgs
    tf
    tf_conversions
#  DEPENDS system_lib
)

###########
## Build ##
###########

## No compilation for pure Python scripts.
## We primarily use the install directives below.

#############
## Install ##
#############

# Install Python scripts
# The 'DESTINATION' is relative to CMAKE_INSTALL_PREFIX (which is usually ~/your_ws/install)
# ROS will look for executables in CMAKE_INSTALL_PREFIX/lib/<package_name>/
install(PROGRAMS
  scripts/calibrate_parser.py
  scripts/uav_ibvs_controller.py
  scripts/mock_px4.py
  scripts/mock_yolo.py
  scripts/mock_gimbal.py
  scripts/send_command.py
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} # This usually resolves to lib/<package_name>/
)

# Install launch files
install(DIRECTORY launch/
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
  PATTERN "*.launch"
)

# Install config files (if any, though in your structure, config is empty)
install(DIRECTORY config/
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config
  PATTERN "*.yaml" # Or whatever file types you have in config
)

# Install data files like calibrate.txt
install(FILES
  scripts/calibrate.txt # Ensure this path is correct relative to CMakeLists.txt
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/scripts # Install it where scripts are or in a data folder
)

## Mark test scripts (if any)
# catkin_install_python(PROGRAMS tests/my_test.py
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
